import request from '@/utils/request'
import config from '@/utils/config'
import { splitStr } from '@/api/common'

// 圣爵菲斯酒店-圣爵菲斯酒店

//  商城订单管理列表
export function getStoreOrder(params) {
  console.log('params', params)
  if (params.userName) { // 如果是查询
    let str = '?'
    for (const key in params) {
      str += `${key}=${encodeURIComponent(params[key])}&`
    }
    str = str.substring(0, str.length - 1)
    console.log('拼接结果:', str)
    return request({
      url: config.BaseUrl + '/goodsOrder/query/page' + str,
      method: 'get'
    })
  } else {
    return request({
      url: config.BaseUrl + '/goodsOrder/query/page',
      method: 'get',
      params: params
    })
  }
}

// 查看商品订单详情
export function getGoodsOrder(params) {
  return request({
    url: config.BaseUrl + '/goodsOrder/query',
    method: 'get',
    params
  })
}

// 新增备注 uid vipOrderId remark
export function addGoodsRemark(params) {
  return request({
    url: config.BaseUrl + '/vipOrder/add/remark',
    method: 'post',
    data: params
  })
}

// // 分页查询订单备注记录 vipOrderId
// export function getStoreRemarkPage(params) {
//   return request({
//     url: config.BaseUrl + '/vipOrder/remark/page',
//     method: 'get',
//     params: splitStr(params)
//   })
// }

// 分页查询商品订单备注记录
export function getStoreOrderRemarks(params) {
  return request({
    url: config.BaseUrl + '/goodsOrderRemarks/query/page',
    method: 'get',
    params
  })
}

// 收货地址管理列表
export function getGoodsAddress(params) {
  return request({
    url: config.BaseUrl + '/address/query/page',
    method: 'get',
    params: splitStr(params)
  })
}
